/*
  Copyright 2011 Jonathan Albarrán León

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
 */
package com.jaal.movilconsultanet;

import android.util.Log;

public class SessionCookie {

	private boolean sessionStarted = false;
	private boolean GSMSessionStarted = false;
	private String sessionCookie;
	private String mobileId;

	public boolean isGSMSessionStarted() {
		return GSMSessionStarted;
	}

	public void setGSMSessionStarted(boolean gSMSessionStarted) {
		GSMSessionStarted = gSMSessionStarted;
	}

	public void setSessionStarted(boolean sessionStarted) {
		this.sessionStarted = sessionStarted;
		if (sessionStarted == false) {
			setSessionCookie(null);
		}
	}

	public boolean isSessionStarted() {
		return sessionStarted;
	}

	public void setSessionCookie(String sessionCookie) {
		
		sessionStarted = (sessionCookie != null) ? true : false;
		
		this.sessionCookie = sessionCookie;
	}

	public void checkSessionCookie() {
		Log.d("MCN", "checkSessionCookie - inicio");
		if (!isSessionStarted()) {
			Log.d("MCN", "checkSessionCookie - sesion no iniciada: "
					+ sessionCookie);
		}
		Log.d("MCN", "checkSessionCookie - sesion iniciada: " + sessionCookie);
		Log.d("MCN", "checkSessionCookie - fin");
	}

	public void cleanUpSession() {
		setSessionCookie(null);
		setSessionStarted(false);
	}

	public String getSessionCookie() {
		return sessionCookie;
	}

	public void setMobileId(String mobileId) {
		this.mobileId = mobileId;
	}

	public String getMobileId() {
		return mobileId;
	}
}